﻿@model YogaStudio.Data.Domain.Product

@{
    ViewBag.Title = "Edit";
}
<div class="main">
    <div class="content">
        <div class="section group">
            <div class="col span_2_of_3">
                <div class="contact-form">
                    <h3>Product Update</h3>
                    @using (Html.BeginForm("Edit", "ProductAdmin", null, FormMethod.Post, new { enctype = "multipart/form-data" }))
                    {
                        @Html.AntiForgeryToken()

                        <div class="form-horizontal">
                            <h4>Product</h4>
                            <hr />
                            @Html.ValidationSummary(true)
                            @Html.HiddenFor(model => model.ProductId)

                            <div class="form-group">
                                @Html.LabelFor(model => model.CategoryId, "CategoryId", new { @class = "control-label col-md-2" })
                                <div class="col-md-10">
                                    @Html.DropDownList("CategoryId", String.Empty)
                                    @Html.ValidationMessageFor(model => model.CategoryId)
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.ProductName, new { @class = "control-label col-md-2" })
                                <div class="col-md-10">
                                    @Html.EditorFor(model => model.ProductName)
                                    @Html.ValidationMessageFor(model => model.ProductName)
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.Description, new { @class = "control-label col-md-2" })
                                <div class="col-md-10">
                                    @Html.EditorFor(model => model.Description)
                                    @Html.ValidationMessageFor(model => model.Description)
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.SearchAttributes, new { @class = "control-label col-md-2" })
                                <div class="col-md-10">
                                    @Html.EditorFor(model => model.SearchAttributes)
                                    @Html.ValidationMessageFor(model => model.SearchAttributes)
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.ImageUrl, new { @class = "control-label col-md-2" })
                                <div class="col-md-10">
                                    <img src="@Url.Content(Model.ImageUrl ?? "~/Content/Images/DefaultPicture.jpeg")" alt="Image Not Found" height="30" width="30" />
                                    <input id="ImageUrl" title="Upload a product image"
                                           type="file" name="file" />
                                    @Html.HiddenFor(model => model.ImageUrl)
                                    @Html.ValidationMessageFor(model => model.ImageUrl)
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.Price, new { @class = "control-label col-md-2" })
                                <div class="col-md-10">
                                    @Html.EditorFor(model => model.Price)
                                    @Html.ValidationMessageFor(model => model.Price)
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.IsAvailable, new { @class = "control-label col-md-2" })
                                <div class="col-md-10">
                                    @Html.EditorFor(model => model.IsAvailable)
                                    @Html.ValidationMessageFor(model => model.IsAvailable)
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-md-offset-2 col-md-10">
                                    <input type="submit" value="Save" class="btn btn-default" />
                                    @Html.ActionLink("Back to List", "Index", null, new { @class = "btn", @id = "bluebck" })
                                </div>
                            </div>
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>

</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}